
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="utf-8">
  <title>表白墙 - 爱就大胆说出来</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" th:href="@{/res/layui/css/layui.css}">
  <link rel="stylesheet" th:href="@{/res/css/global.css}">
</head>
<body>

<div class="fly-header layui-bg-black" th:include="common/header.html :: head"></div>
<br>

<div class="layui-container fly-marginTop">
  <div class="fly-panel fly-panel-user" pad20>
    <div class="layui-tab layui-tab-brief" lay-filter="user">
      <ul class="layui-tab-title">
        <li class="layui-this">登入</li>
        <li><a th:href="@{/user/reg}">注册</a></li>
      </ul>
      <div class="layui-form layui-tab-content" id="LAY_ucm" style="padding: 20px 0;">
        <div class="layui-tab-item layui-show">
          <div class="layui-form layui-form-pane">
            <form action="" method="post">
              <div class="layui-form-item">
                <label for="L_email" class="layui-form-label">账号</label>
                <div class="layui-input-inline">
                  <input type="text" id="L_email" name="account" required lay-verify="required" autocomplete="off" class="layui-input">
                </div>
              </div>
              <div class="layui-form-item">
                <label for="L_pass" class="layui-form-label">密码</label>
                <div class="layui-input-inline">
                  <input type="password" id="L_pass" name="password" required lay-verify="required" autocomplete="off" class="layui-input">
                </div>
              </div>
<!--              <div class="layui-form-item">-->
<!--                <label for="L_vercode" class="layui-form-label">人类验证</label>-->
<!--                <div class="layui-input-inline">-->
<!--                  <input type="text" id="L_vercode" name="vercode" required lay-verify="required" placeholder="请回答后面的问题" autocomplete="off" class="layui-input">-->
<!--                </div>-->
<!--                <div class="layui-form-mid">-->
<!--                  <span style="color: #c00;">{{d.vercode}}</span>-->
<!--                </div>-->
<!--              </div>-->
              <div class="layui-form-item">
                <button class="layui-btn" lay-filter="*" lay-submit>登录</button>
                <span style="padding-left:20px;">
                  <a href="">忘记密码？</a>
                </span>
              </div>
              <div class="layui-form-item fly-form-app">
                <span>或者使用社交账号登入</span>
                <a href="" onclick="layer.msg('正在通过QQ登入', {icon:16, shade: 0.1, time:0})" class="iconfont icon-qq" title="QQ登入"></a>
                <p>暂时还未接入qq登录</p>
              </div>
            </form>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>

<div class="fly-footer" th:include="common/footer.html :: foot"></div>
<script th:src="@{/res/layui/layui.js}"></script>
<script>
  layui.cache.page = 'jie';
  layui.cache.user = {
    username: '游客'
    ,uid: -1
    ,avatar: '../../res/images/avatar/00.jpg'
    ,experience: 83
    ,sex: '男'
  };
  layui.config({
    version: "3.0.0"
    ,base: '../../res/mods/'
  }).extend({
    fly: 'index'
  }).use('fly');

  layui.use(['jquery','form','layer'], function(){
    var form = layui.form;
    var $=layui.jquery;
    var layer=layui.layer;

    form.on('submit(*)', function(data){
      $.ajax({
        url:"/user/goLogin",
        data:JSON.stringify(data.field),
        method:"POST",
        contentType : "application/json;charset=UTF-8",//必须
        dataType:"json",
        success:function(data){
          if (data.code === 0) {
            layer.msg("登陆成功");
            setTimeout(function () {location.href = data.action;},1000);
          }else if (data.code === 101) {
            layer.msg("登陆失败！");
          }else{
            layer.msg("服务器繁忙");
          }
        },
        error:function(data){
          layer.msg("服务器繁忙，请稍后再试");
        }
      });
      return false;
    });
  });
</script>
</body>
</html>